package com.easylinkin.linkappapi.deviceunit.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.easylinkin.linkappapi.deviceattribute.entity.DeviceAttribute;
import com.easylinkin.linkappapi.deviceunit.entity.DeviceUnit;


/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author TongJie
 * @since 2020-04-15
 */
public interface DeviceUnitMapper extends BaseMapper<DeviceUnit> {

    List<DeviceUnit> getDeviceUnitWithAttrs(DeviceUnit deviceUnit);

    List<DeviceUnit> selectApplicationDeviceUnitByDeviceType(DeviceUnit deviceUnit);

    List<DeviceUnit> selectDeviceUnits(Page page,@Param("deviceUnit")DeviceUnit deviceUnit);

    Page<DeviceUnit> selectDeviceUnitsLatestVersion(Page page,@Param("deviceUnit")DeviceUnit deviceUnit);

    DeviceUnit selectDeviceUnit(DeviceUnit deviceUnit);

    List<DeviceAttribute> getAttrsById(String id);

    /**
     * 查询可视化配置
     * @param id
     * @return
     */
    String selectVisualizationConfig(@Param("id") String id);

    List<String> selectDeviceUnitVersionList(@Param("code") String code);

    /**
     * 通过设备编号查询对应的物模型信息
     * */
    String selectPhysicsModelByDeviceCode(@Param("code") String code);

    /**
     * 通过设备类型名称查询对应的设备型号
     * @param deviceTypeNames
     * @return
     */
    List<DeviceUnit> selectDeviceUnitByTypeNames(@Param("deviceTypeNames") List<String> deviceTypeNames);
}
